package com.redare.dev.smart.generator.workbench.listener;

import com.redare.dev.smart.generator.sdk.notice.ICodeGenPullListener;
import com.redare.dev.smart.generator.sdk.pojo.CodeGroup;
import com.redare.dev.smart.generator.sdk.pojo.GenPath;
import com.redare.devframework.common.pojo.CommonResult;

/**
 * @author yangqy on 2021/10/9
 * @date 2021/10/9 下午3:44
 */
public class CodeGenPullListener implements ICodeGenPullListener {
    @Override
    public CommonResult<GenPath> getCodeGroupGenPath(CodeGroup codeGroup) {
        if (codeGroup==null){
            return CommonResult.returnFailsWrapper("参数错误");
        }
        String name = codeGroup.getName();
        GenPath path = null;
        switch (name){
            case "sdk":
                path = new GenPath("/Users/yangqiangyu/work_project/2021/smart-generator/smart-generator-sdk/src/main/java/",
                        "com.redare.dev.smart.generator.sdk");
                break;
            case "sdk-impl":
                path = new GenPath("/Users/yangqiangyu/work_project/2021/smart-generator/smart-generator-service/src/main/java/",
                        "com.redare.dev.smart.generator.service");
                break;
            case "manager-controller":
            case "new-manager-controller":
                path = new GenPath("/Users/yangqiangyu/work_project/2021/smart-generator/smart-generator-admin/src/main/java/",
                        "com.redare.dev.smart.generator.admin");
                break;
            case "manager-ant-grid-view":
                path = new GenPath("/Users/yangqiangyu/work_project/2021/smart-generator/smart-generator-admin/webappsrc/src/",
                        "");
                break;
            default:
                break;
        }
        return CommonResult.returnDataWrapper(path);
    }
}
